package models

import (
	"fmt"
	"github.com/astaxie/beego/orm"
	)

type CompanyInfo struct {
	Id   int64
	Companyid string
	Companyname string
	Departments string
	Areas   string
}


//根据设备id查询设备所属公司
func QueryCompanyByLabelid(labelid string)string {
	o := orm.NewOrm()
	var labelrows []LabelInfo
	if _, err := o.Raw("SELECT * FROM label_info WHERE labelid = ?  ", labelid).QueryRows(&labelrows); err != nil {
		fmt.Println("err")
	}
	company := ""
	for _, labelrow := range labelrows {
		company = labelrow.Unit
	}
	return company
}